cd kernel

echo Compiling kernel...

echo 	start.asm...
nasm -w-all -f elf -o start.o start.asm

echo 	main.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
echo 	vga.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o vga.o vga.c
echo 	gdt.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o gdt.o gdt.c
echo 	idt.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o idt.o idt.c
echo 	isrs.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o isrs.o isrs.c
echo 	irq.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o irq.o irq.c
echo 	timer.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o timer.o timer.c
echo 	kb.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o kb.o kb.c
echo 	mem.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o mem.o mem.c
echo 	str.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o str.o str.c
echo 	floppy.c...
gcc -w -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o floppy.o floppy.c

rem This links all your files. Remember that as you add *.o files, you need to
rem add them after start.o. If you don't add them at all, they won't be in your kernel!
echo Linking kernel...
i686-elf-ld -T link.ld -o kernel.bin start.o main.o vga.o gdt.o idt.o isrs.o irq.o timer.o kb.o mem.o str.o floppy.o

cd ..